package org.dbrd.model;

public class GhostPrecessingBugReport extends PrecessingBugReport {

	// public GhostPrecessingBugReport(int id, String summary, int duplicateId)
	// {
	// super(id, summary, duplicateId);
	// }

	@Override
	public void preAdjustDuplicateId() {
		throw new UnsupportedOperationException();
	}

	public GhostPrecessingBugReport(int id) {
		super(id, null, null, NON_DUPLICATE, 0, null, null, null, null);
	}

	// protected IdHolder adjustDuplicateId(IdHolder idHolder) {
	// if (this.visited) {
	// if (this.tempDuplicateIdHolder == null) {
	// throw new RuntimeException();
	// }
	// return this.tempDuplicateIdHolder;
	// }
	// this.visited = true;
	// this.tempDuplicateIdHolder = idHolder;
	// return idHolder;
	// }
	@Override
	protected void passIdHolder(IdHolder idHolder) {
		if (this.visited) {
			if (idHolder != this.tempDuplicateIdHolder) {
				throw new RuntimeException();
			}
			return;
		} else {
			this.visited = true;
			if (this.tempDuplicateIdHolder != null) {
				throw new RuntimeException();
			}
			this.tempDuplicateIdHolder = idHolder;
			// if (idHolder.id > this.id) {
			// idHolder.id = this.id;
			// }
			if (this.original != null)
				this.original.passIdHolder(idHolder);
			for (PrecessingBugReport r : this.duplicates) {
				r.passIdHolder(idHolder);
			}
		}
	}

}
